import {serviceModulePrefix, useDecorateApi} from "@/utils/tools";
import request from "@/utils/request";


// 查询当前班课的协作人员
export const apiBkManageList = (bkId, opts) => useDecorateApi(request({
  url: `${serviceModulePrefix}/info/manageInfo/${bkId}`
}), {
  dataCleaning: res => res.data || [],
  ...opts,
})


// 搜索可参与协作的人员
export const apiWithUserList = (phone, opts) => useDecorateApi(request({
  url: `${serviceModulePrefix}/info/phone/${phone}`
}), {
  dataCleaning: res => res.data ? [res.data] : [],
  ...opts,
})


// 添加协作人员
export const apiAddUserWithMe = ({bkId, userId}, opts) => useDecorateApi(request({
  url: `${serviceModulePrefix}/info/collaborator/${bkId}/${userId}`,
  method: 'put'
}), opts)


// 移除协作人员
export const apiDelUserWithMe = ({bkId, userId}, opts) => useDecorateApi(request({
  url: `${serviceModulePrefix}/info/collaborator/${bkId}/${userId}`,
  method: 'delete'
}), opts)
